package com.qiuyuliantu.base.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qiuyuliantu.common.annotation.Log;
import com.qiuyuliantu.common.core.controller.BaseController;
import com.qiuyuliantu.common.core.domain.AjaxResult;
import com.qiuyuliantu.common.enums.BusinessType;
import com.qiuyuliantu.base.domain.QiuUserInfo;
import com.qiuyuliantu.base.service.IQiuUserInfoService;
import com.qiuyuliantu.common.utils.poi.ExcelUtil;
import com.qiuyuliantu.common.core.page.TableDataInfo;

/**
 * 存储情侣的亲人信息Controller
 *
 * @author ruoyi
 * @date 2025-04-02
 */
@RestController
@RequestMapping("/base/info")
public class QiuUserInfoController extends BaseController
{
    @Autowired
    private IQiuUserInfoService sysUserInfoService;

    /**
     * 查询存储情侣的亲人信息列表
     */
    @PreAuthorize("@ss.hasPermi('base:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(QiuUserInfo qiuUserInfo)
    {
        startPage();
        List<QiuUserInfo> list = sysUserInfoService.selectSysUserInfoList(qiuUserInfo);
        return getDataTable(list);
    }

    /**
     * 导出存储情侣的亲人信息列表
     */
    @PreAuthorize("@ss.hasPermi('base:info:export')")
    @Log(title = "存储情侣的亲人信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, QiuUserInfo qiuUserInfo)
    {
        List<QiuUserInfo> list = sysUserInfoService.selectSysUserInfoList(qiuUserInfo);
        ExcelUtil<QiuUserInfo> util = new ExcelUtil<QiuUserInfo>(QiuUserInfo.class);
        util.exportExcel(response, list, "存储情侣的亲人信息数据");
    }

    /**
     * 获取存储情侣的亲人信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('base:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysUserInfoService.selectSysUserInfoById(id));
    }

    /**
     * 新增存储情侣的亲人信息
     */
    @PreAuthorize("@ss.hasPermi('base:info:add')")
    @Log(title = "存储情侣的亲人信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QiuUserInfo qiuUserInfo)
    {
        return toAjax(sysUserInfoService.insertSysUserInfo(qiuUserInfo));
    }

    /**
     * 修改存储情侣的亲人信息
     */
    @PreAuthorize("@ss.hasPermi('base:info:edit')")
    @Log(title = "存储情侣的亲人信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QiuUserInfo qiuUserInfo)
    {
        return toAjax(sysUserInfoService.updateSysUserInfo(qiuUserInfo));
    }

    /**
     * 删除存储情侣的亲人信息
     */
    @PreAuthorize("@ss.hasPermi('base:info:remove')")
    @Log(title = "存储情侣的亲人信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysUserInfoService.deleteSysUserInfoByIds(ids));
    }
}
